home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / 1.098 / Include / ds3100.md / graphics.h < prev    next >
Text File  |  1989-07-08  |  8KB  |  284 lines

  1. /* 
  2.  *  graphics.h --
  3.  *
  4.  *         Defines for the graphics device.
  5.  *
  6.  * Copyright (C) 1989 by Digital Equipment Corporation, Maynard MA
  7.  *
  8.  *            All Rights Reserved
  9.  *
  10.  * Permission to use, copy, modify, and distribute this software and its 
  11.  * documentation for any purpose and without fee is hereby granted, 
  12.  * provided that the above copyright notice appear in all copies and that
  13.  * both that copyright notice and this permission notice appear in 
  14.  * supporting documentation, and that the name of Digital not be
  15.  * used in advertising or publicity pertaining to distribution of the
  16.  * software without specific, written prior permission.  
  17.  *
  18.  * Digitial disclaims all warranties with regard to this software, including
  19.  * all implied warranties of merchantability and fitness.  In no event shall
  20.  * Digital be liable for any special, indirect or consequential damages or
  21.  * any damages whatsoever resulting from loss of use, data or profits,
  22.  * whether in an action of contract, negligence or other tortious action,
  23.  * arising out of or in connection with the use or performance of this
  24.  * software.
  25.  *
  26.  * $Header: devSerialPmax.c,v 1.4 89/05/22 13:31:07 mnelson Exp $ SPRITE (DECWRL)
  27.  */
  28.  
  29. /*
  30.  * Defines for the system control and status register.
  31.  *
  32.  *    SYS_CSR_ADDR    The address where it lives.
  33.  *    SYS_CSR_MONO    Bit to tell whether we have a monochrome or
  34.  *                a color frame buffer.
  35.  */
  36. #define SYS_CSR_ADDR    0xbe000000
  37. #define SYS_CSR_MONO    0x0800
  38.  
  39. /*
  40.  * Cursor command register bits.
  41.  *
  42.  *     CURSOR_ENPA    Enable cursor plane A.
  43.  *     CURSOR_FOPA    Force cursor plane A to output 1.
  44.  *     CURSOR_ENPB    Enable cursor plane B.
  45.  *     CURSOR_FOPB    Force cursor plane B to output 1.
  46.  *     CURSOR_XHAIR    
  47.  *     CURSOR_XHCLP    Clip crosshair inside region.    
  48.  *     CURSOR_XHCL1    Select crosshair clipping region.
  49.  *     CURSOR_XHWID    Crosshair cursor line width.
  50.  *     CURSOR_ENRG1    Enable region detector 1.
  51.  *     CURSOR_FORG1    Force region detector 1 to output 1.
  52.  *     CURSOR_ENRG2    Enable region detector 2.
  53.  *     CURSOR_FORG2    Force region detector 2 to output 1.
  54.  *     CURSOR_LODSA    Load/display sprite array.
  55.  *     CURSOR_VBHI    Vertical blank polarity.
  56.  *     CURSOR_HSHI    Horizontal sync polarity.
  57.  *     CURSOR_TEST    Diagnostic test.
  58.  */
  59. #define CURSOR_ENPA    0x0001
  60. #define CURSOR_FOPA    0x0002
  61. #define CURSOR_ENPB    0x0004
  62. #define CURSOR_FOPB    0x0008
  63. #define CURSOR_XHAIR    0x0010
  64. #define CURSOR_XHCLP    0x0020
  65. #define CURSOR_XHCL1    0x0040
  66. #define CURSOR_XHWID    0x0080
  67. #define CURSOR_ENRG1    0x0100
  68. #define CURSOR_FORG1    0x0200
  69. #define CURSOR_ENRG2    0x0400
  70. #define CURSOR_FORG2    0x0800
  71. #define CURSOR_LODSA    0x1000
  72. #define CURSOR_VBHI    0x2000
  73. #define CURSOR_HSHI    0x4000
  74. #define CURSOR_TEST    0x8000
  75.  
  76. /*
  77.  * Physical addresses of entities in the memory map.
  78.  */
  79. #define CURSOR_REG_ADDR        0xb1000000
  80. #define FRAME_BUF_ADDR        0xafc00000
  81. #define VDAC_ADDR        0xb2000000
  82. #define PLANE_MASK_ADDR        0xb0000000
  83.  
  84. /*
  85.  * The cursor register.
  86.  */
  87. typedef volatile struct {
  88.     unsigned short    cmdReg;    /* Command register. */
  89.     unsigned short    pad1;
  90.     unsigned short    xPos;    /* X position. */
  91.     unsigned short    pad2;
  92.     unsigned short    yPos;    /* Y position. */
  93.     unsigned short    pad3;
  94.     unsigned short    xMin1;
  95.     unsigned short    pad4;
  96.     unsigned short    xMax1;
  97.     unsigned short    pad5;
  98.     unsigned short    yMin1;
  99.     unsigned short    pad6;
  100.     unsigned short    yMax1;
  101.     unsigned short    pad7;
  102.     unsigned short    unused7;
  103.     unsigned short    padUnused7;
  104.     unsigned short    unused8;
  105.     unsigned short    padUnused8;
  106.     unsigned short    unused9;
  107.     unsigned short    padUnused9;
  108.     unsigned short    unusedA;
  109.     unsigned short    padUnusedA;
  110.     unsigned short    xMin2;
  111.     unsigned short    pad8;
  112.     unsigned short    xMax2;
  113.     unsigned short    pad9;
  114.     unsigned short    yMin2;
  115.     unsigned short    padA;
  116.     unsigned short    yMax2;
  117.     unsigned short    padB;
  118.     unsigned short    memory;
  119.     unsigned short    padC;
  120. } PCCRegs;
  121.  
  122. /*
  123.  * The VDAC register.
  124.  */
  125. typedef volatile struct {
  126.     unsigned char   mapWA;
  127.     unsigned char   pad0;
  128.     unsigned short  pad1;
  129.  
  130.     unsigned char   map;
  131.     unsigned char   pad2;
  132.     unsigned short  pad3;
  133.  
  134.     unsigned char   mask;
  135.     unsigned char   pad4;
  136.     unsigned short  pad5;
  137.  
  138.     unsigned char   mapRA;
  139.     unsigned char   pad6;
  140.     unsigned short  pad7;
  141.  
  142.     unsigned char   overWA;
  143.     unsigned char   pad8;
  144.     unsigned short  pad9;
  145.  
  146.     unsigned char   over;
  147.     unsigned char   pad10;
  148.     unsigned short  pad11;
  149.  
  150.     unsigned char   reserved;
  151.     unsigned char   pad12;
  152.     unsigned short  pad13;
  153.  
  154.     unsigned char   overRA;
  155.     unsigned char   pad14;
  156.     unsigned short  pad15;
  157. } VDACRegs;
  158.  
  159. /*
  160.  *  Events.
  161.  */
  162. typedef struct {
  163.         short            x;        /* x position */
  164.         short             y;        /* y position */
  165.         unsigned int    time;        /* 1 millisecond units */
  166.         unsigned char   type;        /* button up/down/raw or motion */
  167.         unsigned char   key;        /* the key (button only) */
  168.         unsigned char   index;        /* which instance of device */
  169.         unsigned char   device;        /* which device */
  170. } Event;
  171.  
  172. /*
  173.  * type field
  174.  */
  175. #define BUTTON_UP_TYPE          0
  176. #define BUTTON_DOWN_TYPE        1
  177. #define BUTTON_RAW_TYPE         2
  178. #define MOTION_TYPE             3
  179.  
  180. /*
  181.  * device field
  182.  */
  183. #define NULL_DEVICE      0        /* NULL event (for QD_GETEVENT ret) */
  184. #define MOUSE_DEVICE      1        /* mouse */
  185. #define KEYBOARD_DEVICE      2        /* main keyboard */
  186. #define TABLET_DEVICE      3        /* graphics tablet */
  187. #define AUX_DEVICE      4        /* auxiliary */
  188. #define CONSOLE_DEVICE      5        /* console */
  189. #define KNOB_DEVICE      8
  190. #define JOYSTICK_DEVICE      9
  191.  
  192. #define MAXEVQ    64    /* must be power of 2 */
  193. #define EVROUND(x)    ((x) & (MAXEVQ - 1))
  194. #define TABLET_RES    2
  195.  
  196. typedef struct {
  197.     unsigned int    time;
  198.     short        x, y;
  199. } TimeCoord;
  200.  
  201. /*
  202.  * The event queue. This structure is normally included in the info
  203.  * returned by the device driver.
  204.  */
  205. typedef struct {
  206.     Event        *events;
  207.     unsigned int     eSize;
  208.         unsigned int    eHead;
  209.         unsigned int    eTail;
  210.     unsigned    long    timestampMS;
  211.     TimeCoord    *tcs;    /* history of pointer motions */
  212.     unsigned int    tcSize;
  213.     unsigned int    tcNext;    /* simple ring buffer, old events are tossed */
  214. } EventQueue;
  215.  
  216. /* 
  217.  * mouse cursor position
  218.  */
  219. typedef struct {
  220.         short x;
  221.         short y;
  222. } Cursor;
  223.  
  224. /* 
  225.  * mouse motion rectangle
  226.  */
  227. typedef struct {
  228.         short bottom;
  229.         short right;
  230.         short left;
  231.         short top;
  232. } Box;
  233.  
  234. /*
  235.  * Structures used by iocontrols.
  236.  */
  237. typedef struct {
  238.     char nbytes;        /* Number of bytes in parameter */
  239.     unsigned char cmd;    /* Command to be sent, peripheral bit will */
  240.                 /* be forced by driver */
  241.     unsigned char par[2];    /* Bytes of parameters to be sent */
  242. } KpCmd;
  243.  
  244. typedef struct {
  245.     EventQueue eventQueue;        /* event & motion queues    */
  246.     short    mswitches;        /* current value of mouse buttons */
  247.     Cursor tablet;        /* current tablet position    */
  248.     short    tswitches;        /* current tablet buttons NI!    */
  249.     Cursor cursor;        /* current cursor position    */
  250.     short    row;            /* screen row            */
  251.     short    col;            /* screen col            */
  252.     short    maxRow;            /* max character row        */
  253.     short    maxCol;            /* max character col        */
  254.     short    maxX;            /* max x position        */
  255.     short    maxY;            /* max y position        */
  256.     short    maxCurX;        /* max cursor x position     */
  257.     short    maxCurY;        /* max cursor y position    */
  258.     int    version;        /* version of driver        */
  259.     char    *bitmap;        /* bit map position        */
  260.         short   *scanmap;               /* scanline map position        */
  261.     short    *cursorBits;        /* cursor bit position        */
  262.     short    *vaddr;            /* virtual address               */
  263.     char    *planeMask;        /* plane mask virtual location  */
  264.     Cursor mouse;            /* atomic read/write        */
  265.     Box    mbox;            /* atomic read/write        */
  266.     short    mthreshold;        /* mouse motion parameter    */
  267.     short    mscale;            /* mouse scale factor (if 
  268.                        negative, then do square).    */
  269.     short    minCurX;        /* min cursor x position    */
  270.     short    minCurY;        /* min cursor y position    */
  271. } ScreenInfo;
  272.  
  273. typedef struct {
  274.     short        map;
  275.     unsigned short    index;
  276.     struct {
  277.         unsigned short red;
  278.         unsigned short green;
  279.         unsigned short blue;
  280.     } entry;
  281. } ColorMap;
  282.  
  283.  
  284.